﻿using System;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using System.Text;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Ocean.His.MedicalInsurance
{
    /// <summary>
    /// 目录版本
    /// </summary>
    public class CatalogueVersion : FullAuditedAggregateRoot<Guid>, IMultiTenant
    {
        /// <summary>
        /// 分类
        /// </summary>
        public EnumCatalogueType CatalogueType { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        public string Ver { get; set; }

        /// <summary>
        /// 有效
        /// </summary>
        public bool IsValid { get; set; }

        /// <summary>
        /// 排序
        /// </summary>
        public int Sort { get; set; }

        /// <summary>
        /// 目录同步记录
        /// </summary>
        public List<CatalogueSyncRecord> CatalogueSyncRecords { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }

        public CatalogueVersion()
        {

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="catalogueType"></param>
        /// <param name="ver"></param>
        public CatalogueVersion(EnumCatalogueType catalogueType, string ver)
        {
            CatalogueType = catalogueType;
            Ver = ver;
            IsValid = true;
            Sort = 0;
            CatalogueSyncRecords = new List<CatalogueSyncRecord>();
        }

        public void AddSyncRecord(string fileQuryNo, string filename, string dldEndtime, string dataCnt, string ver)
        {
            CatalogueSyncRecord catalogueSyncRecord = new CatalogueSyncRecord();
            catalogueSyncRecord.FileQuryNo = fileQuryNo;
            catalogueSyncRecord.Filename = filename;
            catalogueSyncRecord.DldEndtime = dldEndtime;
            catalogueSyncRecord.DataCnt = dataCnt;
            catalogueSyncRecord.FileQuryNo = fileQuryNo;
        }
    }
}
